1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gio.DtlsConnectionIF;
26 
27 private import gio.AsyncResultIF;
28 private import gio.Cancellable;
29 private import gio.TlsCertificate;
30 private import gio.TlsDatabase;
31 private import gio.TlsInteraction;
32 private import gio.c.functions;
33 public  import gio.c.types;
34 private import glib.ByteArray;
35 private import glib.ErrorG;
36 private import glib.GException;
37 private import glib.MemorySlice;
38 private import glib.Str;
39 private import glib.c.functions;
40 private import gobject.ObjectG;
41 private import gobject.Signals;
42 private import std.algorithm;
43 
44 
45 /**
46  * #GDtlsConnection is the base DTLS connection class type, which wraps
47  * a #GDatagramBased and provides DTLS encryption on top of it. Its
48  * subclasses, #GDtlsClientConnection and #GDtlsServerConnection,
49  * implement client-side and server-side DTLS, respectively.
50  * 
51  * For TLS support, see #GTlsConnection.
52  * 
53  * As DTLS is datagram based, #GDtlsConnection implements #GDatagramBased,
54  * presenting a datagram-socket-like API for the encrypted connection. This
55  * operates over a base datagram connection, which is also a #GDatagramBased
56  * (#GDtlsConnection:base-socket).
57  * 
58  * To close a DTLS connection, use g_dtls_connection_close().
59  * 
60  * Neither #GDtlsServerConnection or #GDtlsClientConnection set the peer address
61  * on their base #GDatagramBased if it is a #GSocket — it is up to the caller to
62  * do that if they wish. If they do not, and g_socket_close() is called on the
63  * base socket, the #GDtlsConnection will not raise a %G_IO_ERROR_NOT_CONNECTED
64  * error on further I/O.
65  *
66  * Since: 2.48
67  */
68 public interface DtlsConnectionIF{
69 	/** Get the main Gtk struct */
70 	public GDtlsConnection* getDtlsConnectionStruct(bool transferOwnership = false);
71 
72 	/** the main Gtk struct as a void* */
73 	protected void* getStruct();
74 
75 
76 	/** */
77 	public static GType getType()
78 	{
79 		return g_dtls_connection_get_type();
80 	}
81 
82 	/**
83 	 * Close the DTLS connection. This is equivalent to calling
84 	 * g_dtls_connection_shutdown() to shut down both sides of the connection.
85 	 *
86 	 * Closing a #GDtlsConnection waits for all buffered but untransmitted data to
87 	 * be sent before it completes. It then sends a `close_notify` DTLS alert to the
88 	 * peer and may wait for a `close_notify` to be received from the peer. It does
89 	 * not close the underlying #GDtlsConnection:base-socket; that must be closed
90 	 * separately.
91 	 *
92 	 * Once @conn is closed, all other operations will return %G_IO_ERROR_CLOSED.
93 	 * Closing a #GDtlsConnection multiple times will not return an error.
94 	 *
95 	 * #GDtlsConnections will be automatically closed when the last reference is
96 	 * dropped, but you might want to call this function to make sure resources are
97 	 * released as early as possible.
98 	 *
99 	 * If @cancellable is cancelled, the #GDtlsConnection may be left
100 	 * partially-closed and any pending untransmitted data may be lost. Call
101 	 * g_dtls_connection_close() again to complete closing the #GDtlsConnection.
102 	 *
103 	 * Params:
104 	 *     cancellable = a #GCancellable, or %NULL
105 	 *
106 	 * Returns: %TRUE on success, %FALSE otherwise
107 	 *
108 	 * Since: 2.48
109 	 *
110 	 * Throws: GException on failure.
111 	 */
112 	public bool close(Cancellable cancellable);
113 
114 	/**
115 	 * Asynchronously close the DTLS connection. See g_dtls_connection_close() for
116 	 * more information.
117 	 *
118 	 * Params:
119 	 *     ioPriority = the [I/O priority][io-priority] of the request
120 	 *     cancellable = a #GCancellable, or %NULL
121 	 *     callback = callback to call when the close operation is complete
122 	 *     userData = the data to pass to the callback function
123 	 *
124 	 * Since: 2.48
125 	 */
126 	public void closeAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
127 
128 	/**
129 	 * Finish an asynchronous TLS close operation. See g_dtls_connection_close()
130 	 * for more information.
131 	 *
132 	 * Params:
133 	 *     result = a #GAsyncResult
134 	 *
135 	 * Returns: %TRUE on success, %FALSE on failure, in which
136 	 *     case @error will be set
137 	 *
138 	 * Since: 2.48
139 	 *
140 	 * Throws: GException on failure.
141 	 */
142 	public bool closeFinish(AsyncResultIF result);
143 
144 	/**
145 	 * Used by #GDtlsConnection implementations to emit the
146 	 * #GDtlsConnection::accept-certificate signal.
147 	 *
148 	 * Params:
149 	 *     peerCert = the peer's #GTlsCertificate
150 	 *     errors = the problems with @peer_cert
151 	 *
152 	 * Returns: %TRUE if one of the signal handlers has returned
153 	 *     %TRUE to accept @peer_cert
154 	 *
155 	 * Since: 2.48
156 	 */
157 	public bool emitAcceptCertificate(TlsCertificate peerCert, GTlsCertificateFlags errors);
158 
159 	/**
160 	 * Gets @conn's certificate, as set by
161 	 * g_dtls_connection_set_certificate().
162 	 *
163 	 * Returns: @conn's certificate, or %NULL
164 	 *
165 	 * Since: 2.48
166 	 */
167 	public TlsCertificate getCertificate();
168 
169 	/**
170 	 * Query the TLS backend for TLS channel binding data of @type for @conn.
171 	 *
172 	 * This call retrieves TLS channel binding data as specified in RFC
173 	 * [5056](https://tools.ietf.org/html/rfc5056), RFC
174 	 * [5929](https://tools.ietf.org/html/rfc5929), and related RFCs.  The
175 	 * binding data is returned in @data.  The @data is resized by the callee
176 	 * using #GByteArray buffer management and will be freed when the @data
177 	 * is destroyed by g_byte_array_unref(). If @data is %NULL, it will only
178 	 * check whether TLS backend is able to fetch the data (e.g. whether @type
179 	 * is supported by the TLS backend). It does not guarantee that the data
180 	 * will be available though.  That could happen if TLS connection does not
181 	 * support @type or the binding data is not available yet due to additional
182 	 * negotiation or input required.
183 	 *
184 	 * Params:
185 	 *     type = #GTlsChannelBindingType type of data to fetch
186 	 *     data = #GByteArray is
187 	 *         filled with the binding data, or %NULL
188 	 *
189 	 * Returns: %TRUE on success, %FALSE otherwise
190 	 *
191 	 * Since: 2.66
192 	 *
193 	 * Throws: GException on failure.
194 	 */
195 	public bool getChannelBindingData(GTlsChannelBindingType type, out ByteArray data);
196 
197 	/**
198 	 * Returns the name of the current DTLS ciphersuite, or %NULL if the
199 	 * connection has not handshaked or has been closed. Beware that the TLS
200 	 * backend may use any of multiple different naming conventions, because
201 	 * OpenSSL and GnuTLS have their own ciphersuite naming conventions that
202 	 * are different from each other and different from the standard, IANA-
203 	 * registered ciphersuite names. The ciphersuite name is intended to be
204 	 * displayed to the user for informative purposes only, and parsing it
205 	 * is not recommended.
206 	 *
207 	 * Returns: The name of the current DTLS ciphersuite, or %NULL
208 	 *
209 	 * Since: 2.70
210 	 */
211 	public string getCiphersuiteName();
212 
213 	/**
214 	 * Gets the certificate database that @conn uses to verify
215 	 * peer certificates. See g_dtls_connection_set_database().
216 	 *
217 	 * Returns: the certificate database that @conn uses or %NULL
218 	 *
219 	 * Since: 2.48
220 	 */
221 	public TlsDatabase getDatabase();
222 
223 	/**
224 	 * Get the object that will be used to interact with the user. It will be used
225 	 * for things like prompting the user for passwords. If %NULL is returned, then
226 	 * no user interaction will occur for this connection.
227 	 *
228 	 * Returns: The interaction object.
229 	 *
230 	 * Since: 2.48
231 	 */
232 	public TlsInteraction getInteraction();
233 
234 	/**
235 	 * Gets the name of the application-layer protocol negotiated during
236 	 * the handshake.
237 	 *
238 	 * If the peer did not use the ALPN extension, or did not advertise a
239 	 * protocol that matched one of @conn's protocols, or the TLS backend
240 	 * does not support ALPN, then this will be %NULL. See
241 	 * g_dtls_connection_set_advertised_protocols().
242 	 *
243 	 * Returns: the negotiated protocol, or %NULL
244 	 *
245 	 * Since: 2.60
246 	 */
247 	public string getNegotiatedProtocol();
248 
249 	/**
250 	 * Gets @conn's peer's certificate after the handshake has completed
251 	 * or failed. (It is not set during the emission of
252 	 * #GDtlsConnection::accept-certificate.)
253 	 *
254 	 * Returns: @conn's peer's certificate, or %NULL
255 	 *
256 	 * Since: 2.48
257 	 */
258 	public TlsCertificate getPeerCertificate();
259 
260 	/**
261 	 * Gets the errors associated with validating @conn's peer's
262 	 * certificate, after the handshake has completed or failed. (It is
263 	 * not set during the emission of #GDtlsConnection::accept-certificate.)
264 	 *
265 	 * Returns: @conn's peer's certificate errors
266 	 *
267 	 * Since: 2.48
268 	 */
269 	public GTlsCertificateFlags getPeerCertificateErrors();
270 
271 	/**
272 	 * Returns the current DTLS protocol version, which may be
273 	 * %G_TLS_PROTOCOL_VERSION_UNKNOWN if the connection has not handshaked, or
274 	 * has been closed, or if the TLS backend has implemented a protocol version
275 	 * that is not a recognized #GTlsProtocolVersion.
276 	 *
277 	 * Returns: The current DTLS protocol version
278 	 *
279 	 * Since: 2.70
280 	 */
281 	public GTlsProtocolVersion getProtocolVersion();
282 
283 	/**
284 	 * Gets @conn rehandshaking mode. See
285 	 * g_dtls_connection_set_rehandshake_mode() for details.
286 	 *
287 	 * Deprecated: Changing the rehandshake mode is no longer
288 	 * required for compatibility. Also, rehandshaking has been removed
289 	 * from the TLS protocol in TLS 1.3.
290 	 *
291 	 * Returns: %G_TLS_REHANDSHAKE_SAFELY
292 	 *
293 	 * Since: 2.48
294 	 */
295 	public GTlsRehandshakeMode getRehandshakeMode();
296 
297 	/**
298 	 * Tests whether or not @conn expects a proper TLS close notification
299 	 * when the connection is closed. See
300 	 * g_dtls_connection_set_require_close_notify() for details.
301 	 *
302 	 * Returns: %TRUE if @conn requires a proper TLS close notification.
303 	 *
304 	 * Since: 2.48
305 	 */
306 	public bool getRequireCloseNotify();
307 
308 	/**
309 	 * Attempts a TLS handshake on @conn.
310 	 *
311 	 * On the client side, it is never necessary to call this method;
312 	 * although the connection needs to perform a handshake after
313 	 * connecting, #GDtlsConnection will handle this for you automatically
314 	 * when you try to send or receive data on the connection. You can call
315 	 * g_dtls_connection_handshake() manually if you want to know whether
316 	 * the initial handshake succeeded or failed (as opposed to just
317 	 * immediately trying to use @conn to read or write, in which case,
318 	 * if it fails, it may not be possible to tell if it failed before
319 	 * or after completing the handshake), but beware that servers may reject
320 	 * client authentication after the handshake has completed, so a
321 	 * successful handshake does not indicate the connection will be usable.
322 	 *
323 	 * Likewise, on the server side, although a handshake is necessary at
324 	 * the beginning of the communication, you do not need to call this
325 	 * function explicitly unless you want clearer error reporting.
326 	 *
327 	 * Previously, calling g_dtls_connection_handshake() after the initial
328 	 * handshake would trigger a rehandshake; however, this usage was
329 	 * deprecated in GLib 2.60 because rehandshaking was removed from the
330 	 * TLS protocol in TLS 1.3. Since GLib 2.64, calling this function after
331 	 * the initial handshake will no longer do anything.
332 	 *
333 	 * #GDtlsConnection::accept_certificate may be emitted during the
334 	 * handshake.
335 	 *
336 	 * Params:
337 	 *     cancellable = a #GCancellable, or %NULL
338 	 *
339 	 * Returns: success or failure
340 	 *
341 	 * Since: 2.48
342 	 *
343 	 * Throws: GException on failure.
344 	 */
345 	public bool handshake(Cancellable cancellable);
346 
347 	/**
348 	 * Asynchronously performs a TLS handshake on @conn. See
349 	 * g_dtls_connection_handshake() for more information.
350 	 *
351 	 * Params:
352 	 *     ioPriority = the [I/O priority][io-priority] of the request
353 	 *     cancellable = a #GCancellable, or %NULL
354 	 *     callback = callback to call when the handshake is complete
355 	 *     userData = the data to pass to the callback function
356 	 *
357 	 * Since: 2.48
358 	 */
359 	public void handshakeAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
360 
361 	/**
362 	 * Finish an asynchronous TLS handshake operation. See
363 	 * g_dtls_connection_handshake() for more information.
364 	 *
365 	 * Params:
366 	 *     result = a #GAsyncResult.
367 	 *
368 	 * Returns: %TRUE on success, %FALSE on failure, in which
369 	 *     case @error will be set.
370 	 *
371 	 * Since: 2.48
372 	 *
373 	 * Throws: GException on failure.
374 	 */
375 	public bool handshakeFinish(AsyncResultIF result);
376 
377 	/**
378 	 * Sets the list of application-layer protocols to advertise that the
379 	 * caller is willing to speak on this connection. The
380 	 * Application-Layer Protocol Negotiation (ALPN) extension will be
381 	 * used to negotiate a compatible protocol with the peer; use
382 	 * g_dtls_connection_get_negotiated_protocol() to find the negotiated
383 	 * protocol after the handshake.  Specifying %NULL for the the value
384 	 * of @protocols will disable ALPN negotiation.
385 	 *
386 	 * See [IANA TLS ALPN Protocol IDs](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids)
387 	 * for a list of registered protocol IDs.
388 	 *
389 	 * Params:
390 	 *     protocols = a %NULL-terminated
391 	 *         array of ALPN protocol names (eg, "http/1.1", "h2"), or %NULL
392 	 *
393 	 * Since: 2.60
394 	 */
395 	public void setAdvertisedProtocols(string[] protocols);
396 
397 	/**
398 	 * This sets the certificate that @conn will present to its peer
399 	 * during the TLS handshake. For a #GDtlsServerConnection, it is
400 	 * mandatory to set this, and that will normally be done at construct
401 	 * time.
402 	 *
403 	 * For a #GDtlsClientConnection, this is optional. If a handshake fails
404 	 * with %G_TLS_ERROR_CERTIFICATE_REQUIRED, that means that the server
405 	 * requires a certificate, and if you try connecting again, you should
406 	 * call this method first. You can call
407 	 * g_dtls_client_connection_get_accepted_cas() on the failed connection
408 	 * to get a list of Certificate Authorities that the server will
409 	 * accept certificates from.
410 	 *
411 	 * (It is also possible that a server will allow the connection with
412 	 * or without a certificate; in that case, if you don't provide a
413 	 * certificate, you can tell that the server requested one by the fact
414 	 * that g_dtls_client_connection_get_accepted_cas() will return
415 	 * non-%NULL.)
416 	 *
417 	 * Params:
418 	 *     certificate = the certificate to use for @conn
419 	 *
420 	 * Since: 2.48
421 	 */
422 	public void setCertificate(TlsCertificate certificate);
423 
424 	/**
425 	 * Sets the certificate database that is used to verify peer certificates.
426 	 * This is set to the default database by default. See
427 	 * g_tls_backend_get_default_database(). If set to %NULL, then
428 	 * peer certificate validation will always set the
429 	 * %G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning
430 	 * #GDtlsConnection::accept-certificate will always be emitted on
431 	 * client-side connections, unless that bit is not set in
432 	 * #GDtlsClientConnection:validation-flags).
433 	 *
434 	 * There are nonintuitive security implications when using a non-default
435 	 * database. See #GDtlsConnection:database for details.
436 	 *
437 	 * Params:
438 	 *     database = a #GTlsDatabase
439 	 *
440 	 * Since: 2.48
441 	 */
442 	public void setDatabase(TlsDatabase database);
443 
444 	/**
445 	 * Set the object that will be used to interact with the user. It will be used
446 	 * for things like prompting the user for passwords.
447 	 *
448 	 * The @interaction argument will normally be a derived subclass of
449 	 * #GTlsInteraction. %NULL can also be provided if no user interaction
450 	 * should occur for this connection.
451 	 *
452 	 * Params:
453 	 *     interaction = an interaction object, or %NULL
454 	 *
455 	 * Since: 2.48
456 	 */
457 	public void setInteraction(TlsInteraction interaction);
458 
459 	/**
460 	 * Since GLib 2.64, changing the rehandshake mode is no longer supported
461 	 * and will have no effect. With TLS 1.3, rehandshaking has been removed from
462 	 * the TLS protocol, replaced by separate post-handshake authentication and
463 	 * rekey operations.
464 	 *
465 	 * Deprecated: Changing the rehandshake mode is no longer
466 	 * required for compatibility. Also, rehandshaking has been removed
467 	 * from the TLS protocol in TLS 1.3.
468 	 *
469 	 * Params:
470 	 *     mode = the rehandshaking mode
471 	 *
472 	 * Since: 2.48
473 	 */
474 	public void setRehandshakeMode(GTlsRehandshakeMode mode);
475 
476 	/**
477 	 * Sets whether or not @conn expects a proper TLS close notification
478 	 * before the connection is closed. If this is %TRUE (the default),
479 	 * then @conn will expect to receive a TLS close notification from its
480 	 * peer before the connection is closed, and will return a
481 	 * %G_TLS_ERROR_EOF error if the connection is closed without proper
482 	 * notification (since this may indicate a network error, or
483 	 * man-in-the-middle attack).
484 	 *
485 	 * In some protocols, the application will know whether or not the
486 	 * connection was closed cleanly based on application-level data
487 	 * (because the application-level data includes a length field, or is
488 	 * somehow self-delimiting); in this case, the close notify is
489 	 * redundant and may be omitted. You
490 	 * can use g_dtls_connection_set_require_close_notify() to tell @conn
491 	 * to allow an "unannounced" connection close, in which case the close
492 	 * will show up as a 0-length read, as in a non-TLS
493 	 * #GDatagramBased, and it is up to the application to check that
494 	 * the data has been fully received.
495 	 *
496 	 * Note that this only affects the behavior when the peer closes the
497 	 * connection; when the application calls g_dtls_connection_close_async() on
498 	 * @conn itself, this will send a close notification regardless of the
499 	 * setting of this property. If you explicitly want to do an unclean
500 	 * close, you can close @conn's #GDtlsConnection:base-socket rather
501 	 * than closing @conn itself.
502 	 *
503 	 * Params:
504 	 *     requireCloseNotify = whether or not to require close notification
505 	 *
506 	 * Since: 2.48
507 	 */
508 	public void setRequireCloseNotify(bool requireCloseNotify);
509 
510 	/**
511 	 * Shut down part or all of a DTLS connection.
512 	 *
513 	 * If @shutdown_read is %TRUE then the receiving side of the connection is shut
514 	 * down, and further reading is disallowed. Subsequent calls to
515 	 * g_datagram_based_receive_messages() will return %G_IO_ERROR_CLOSED.
516 	 *
517 	 * If @shutdown_write is %TRUE then the sending side of the connection is shut
518 	 * down, and further writing is disallowed. Subsequent calls to
519 	 * g_datagram_based_send_messages() will return %G_IO_ERROR_CLOSED.
520 	 *
521 	 * It is allowed for both @shutdown_read and @shutdown_write to be TRUE — this
522 	 * is equivalent to calling g_dtls_connection_close().
523 	 *
524 	 * If @cancellable is cancelled, the #GDtlsConnection may be left
525 	 * partially-closed and any pending untransmitted data may be lost. Call
526 	 * g_dtls_connection_shutdown() again to complete closing the #GDtlsConnection.
527 	 *
528 	 * Params:
529 	 *     shutdownRead = %TRUE to stop reception of incoming datagrams
530 	 *     shutdownWrite = %TRUE to stop sending outgoing datagrams
531 	 *     cancellable = a #GCancellable, or %NULL
532 	 *
533 	 * Returns: %TRUE on success, %FALSE otherwise
534 	 *
535 	 * Since: 2.48
536 	 *
537 	 * Throws: GException on failure.
538 	 */
539 	public bool shutdown(bool shutdownRead, bool shutdownWrite, Cancellable cancellable);
540 
541 	/**
542 	 * Asynchronously shut down part or all of the DTLS connection. See
543 	 * g_dtls_connection_shutdown() for more information.
544 	 *
545 	 * Params:
546 	 *     shutdownRead = %TRUE to stop reception of incoming datagrams
547 	 *     shutdownWrite = %TRUE to stop sending outgoing datagrams
548 	 *     ioPriority = the [I/O priority][io-priority] of the request
549 	 *     cancellable = a #GCancellable, or %NULL
550 	 *     callback = callback to call when the shutdown operation is complete
551 	 *     userData = the data to pass to the callback function
552 	 *
553 	 * Since: 2.48
554 	 */
555 	public void shutdownAsync(bool shutdownRead, bool shutdownWrite, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
556 
557 	/**
558 	 * Finish an asynchronous TLS shutdown operation. See
559 	 * g_dtls_connection_shutdown() for more information.
560 	 *
561 	 * Params:
562 	 *     result = a #GAsyncResult
563 	 *
564 	 * Returns: %TRUE on success, %FALSE on failure, in which
565 	 *     case @error will be set
566 	 *
567 	 * Since: 2.48
568 	 *
569 	 * Throws: GException on failure.
570 	 */
571 	public bool shutdownFinish(AsyncResultIF result);
572 
573 	/**
574 	 * Emitted during the TLS handshake after the peer certificate has
575 	 * been received. You can examine @peer_cert's certification path by
576 	 * calling g_tls_certificate_get_issuer() on it.
577 	 *
578 	 * For a client-side connection, @peer_cert is the server's
579 	 * certificate, and the signal will only be emitted if the
580 	 * certificate was not acceptable according to @conn's
581 	 * #GDtlsClientConnection:validation_flags. If you would like the
582 	 * certificate to be accepted despite @errors, return %TRUE from the
583 	 * signal handler. Otherwise, if no handler accepts the certificate,
584 	 * the handshake will fail with %G_TLS_ERROR_BAD_CERTIFICATE.
585 	 *
586 	 * GLib guarantees that if certificate verification fails, this signal
587 	 * will be emitted with at least one error will be set in @errors, but
588 	 * it does not guarantee that all possible errors will be set.
589 	 * Accordingly, you may not safely decide to ignore any particular
590 	 * type of error. For example, it would be incorrect to ignore
591 	 * %G_TLS_CERTIFICATE_EXPIRED if you want to allow expired
592 	 * certificates, because this could potentially be the only error flag
593 	 * set even if other problems exist with the certificate.
594 	 *
595 	 * For a server-side connection, @peer_cert is the certificate
596 	 * presented by the client, if this was requested via the server's
597 	 * #GDtlsServerConnection:authentication_mode. On the server side,
598 	 * the signal is always emitted when the client presents a
599 	 * certificate, and the certificate will only be accepted if a
600 	 * handler returns %TRUE.
601 	 *
602 	 * Note that if this signal is emitted as part of asynchronous I/O
603 	 * in the main thread, then you should not attempt to interact with
604 	 * the user before returning from the signal handler. If you want to
605 	 * let the user decide whether or not to accept the certificate, you
606 	 * would have to return %FALSE from the signal handler on the first
607 	 * attempt, and then after the connection attempt returns a
608 	 * %G_TLS_ERROR_BAD_CERTIFICATE, you can interact with the user, and
609 	 * if the user decides to accept the certificate, remember that fact,
610 	 * create a new connection, and return %TRUE from the signal handler
611 	 * the next time.
612 	 *
613 	 * If you are doing I/O in another thread, you do not
614 	 * need to worry about this, and can simply block in the signal
615 	 * handler until the UI thread returns an answer.
616 	 *
617 	 * Params:
618 	 *     peerCert = the peer's #GTlsCertificate
619 	 *     errors = the problems with @peer_cert.
620 	 *
621 	 * Returns: %TRUE to accept @peer_cert (which will also
622 	 *     immediately end the signal emission). %FALSE to allow the signal
623 	 *     emission to continue, which will cause the handshake to fail if
624 	 *     no one else overrides it.
625 	 *
626 	 * Since: 2.48
627 	 */
628 	gulong addOnAcceptCertificate(bool delegate(TlsCertificate, GTlsCertificateFlags, DtlsConnectionIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
629 }